package com.hualan.web.wsj;


import com.hualan.pojo.wsj.Cptm;
import com.hualan.service.service.service.wsj.CptmService;
import com.hualan.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Cptm")
public class CptmController {
    @Autowired(required = false)
    private CptmService cptmService;

    @RequestMapping("/listAll")
    public ResultEntity listAll(){
        List<Cptm> cptmList = cptmService.listAll();

        return ResultEntity.ok(cptmList);
    }

//    根据分类查询题目
    @RequestMapping("/listByCategory")
    public ResultEntity listByCategory(Integer category){
        List<Cptm> cptmList = cptmService.listByCategory(category);
        return ResultEntity.ok(cptmList);
    }
}
